#include "tunnel_message.h"

using namespace VL;


/**
 * @Author: CimZzz
 * @Date: 2022-07-15 11:57:11
 * 
 * 构造方法
 * @param dataPtr 数据指针
 * @param dataLength 数据长度
 */
TunnelData::TunnelData(std::shared_ptr<void> dataPtr, unsigned int dataLength): dataPtr(dataPtr), dataLength(dataLength) {
	
}

/**
 * @Author: CimZzz
 * @Date: 2022-07-14 18:51:20
 * 
 * 获取数据指针
 * 
 * @return 数据指针
 */
std::shared_ptr<void> TunnelData::getData() const {
	return this->dataPtr;
}

/**
 * @Author: CimZzz
 * @Date: 2022-07-15 16:41:06
 * 
 * 获取数据长度
 * 
 * @return 数据长度
 */
unsigned int TunnelData::getDataLength() const {
	return this->dataLength;
}

/**
 * @Author: CimZzz
 * @Date: 2022-07-14 18:49:26
 * 
 * 构造方法
 * @param messageCode 消息码
 * @param data 数据智能指针
 * @param dataLength 数据长度
 */
TunnelMessage::TunnelMessage(unsigned long messageCode, std::shared_ptr<void> dataPtr, unsigned int dataLength): messageCode(messageCode), dataPtr(new TunnelData(dataPtr, dataLength)) {

}

/**
 * @Author: CimZzz
 * @Date: 2022-07-14 18:49:26
 * 
 * 构造方法
 * @param messageCode 消息码
 * @param tunnelData 管道数据
 */
TunnelMessage::TunnelMessage(unsigned long messageCode, std::shared_ptr<TunnelData> tunnelData): messageCode(messageCode), dataPtr(tunnelData) {

}

/**
 * @Author: CimZzz
 * @Date: 2022-07-14 18:50:21
 * 
 * 获取消息码
 * 
 * @return 消息码
 */
unsigned long TunnelMessage::getMessageCode() const {
	return this->messageCode;
}



/**
 * @Author: CimZzz
 * @Date: 2022-07-15 16:45:51
 * 
 * 获取管道数据
 * 
 * @return 管道数据
 */
std::shared_ptr<TunnelData> TunnelMessage::getTunnelData() const {
	return this->dataPtr;
}

/**
 * @Author: CimZzz
 * @Date: 2022-07-14 18:51:20
 * 
 * 获取数据指针
 * 
 * @return 数据指针
 */
std::shared_ptr<void> TunnelMessage::getData() const {
	return this->dataPtr->getData();
}

/**
 * @Author: CimZzz
 * @Date: 2022-07-15 16:41:06
 * 
 * 获取数据长度
 * 
 * @return 数据长度
 */
unsigned int TunnelMessage::getDataLength() const {
	return this->dataPtr->getDataLength();
}